﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using AMStudio.Common;
using System.Globalization;
using System.Windows.Forms;
using Microsoft.Practices.ServiceLocation;
using System.Windows.Media;

namespace AMStudio.UserInterface
{
    public class MainUI : AMStudio.Common.AWinFormModule
    {
        public MainUI()
        {
            this.UIName = "MainUI";
            InitializeComponent();
        }
        private DevComponents.DotNetBar.PanelEx panelEx1;
        private DevComponents.DotNetBar.Controls.ReflectionLabel lblPosition;
        private DevComponents.DotNetBar.ButtonX buttonX1;
        private DevComponents.DotNetBar.ButtonX buttonX5;
        private DevComponents.DotNetBar.ButtonX buttonX3;
        private DevComponents.DotNetBar.ButtonX buttonX2;
        private System.Windows.Forms.Label labelIconEmpty;
        private System.Windows.Forms.Label labelIconProd;
        private System.Windows.Forms.Label labelIconError;
        private System.Windows.Forms.Label labelIconFail;
        private System.Windows.Forms.Label label1;
        private System.Windows.Forms.Label lblArticle;
        private System.Windows.Forms.Label lblArticleDescription;
        private System.Windows.Forms.Label lblStartTime;
        private System.Windows.Forms.Label lblQuantity;
        private System.Windows.Forms.Label lblWorkOrder;
        private DevComponents.DotNetBar.PanelEx panelEx2;
        private DevComponents.DotNetBar.PanelEx panelEx3;
        private DevComponents.DotNetBar.Controls.TextBoxX txtStartTime;
        private DevComponents.DotNetBar.Controls.TextBoxX txtQuantity;
        private DevComponents.DotNetBar.Controls.TextBoxX txtWorkOrder;
        private DevComponents.DotNetBar.Controls.TextBoxX txtArticleComments;
        private DevComponents.DotNetBar.Controls.TextBoxX txtArticleDescription;
        private DevComponents.DotNetBar.Controls.TextBoxX txtArticle;
        private System.Windows.Forms.Label label3;
        private System.Windows.Forms.Label label2;
        private System.Windows.Forms.Label labelIconPass;
        private DevComponents.DotNetBar.LabelX labelX1;
        private DevComponents.DotNetBar.ButtonX buttonX6;
        private DevComponents.DotNetBar.ButtonX buttonX444;
        private DevComponents.DotNetBar.Controls.TextBoxX txtYield;
        private System.Windows.Forms.Label label7;
        private DevComponents.DotNetBar.Controls.TextBoxX txtFail;
        private DevComponents.DotNetBar.Controls.TextBoxX txtPass;
        private DevComponents.DotNetBar.Controls.TextBoxX txtRemaining;
        private System.Windows.Forms.Label label4;
        private System.Windows.Forms.Label label5;
        private System.Windows.Forms.Label label6;
        private DevComponents.DotNetBar.Controls.TextBoxX txtLoadedQuantity;
        private System.Windows.Forms.Label label8;
        private DevComponents.DotNetBar.Controls.TextBoxX txtcycletime;
        private System.Windows.Forms.Label label9;
        private Label lblNestID;
        private DevComponents.DotNetBar.ButtonX btnClearPass;
        private System.Windows.Forms.Integration.ElementHost elementHost1;
        private DialTableUserControl dialTable;
        private Windows.Forms.NestTableUI nestTableUI1;

        private void InitializeComponent()
        {
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainUI));
            this.panelEx1 = new DevComponents.DotNetBar.PanelEx();
            this.nestTableUI1 = new AMStudio.Windows.Forms.NestTableUI();
            this.lblNestID = new System.Windows.Forms.Label();
            this.buttonX6 = new DevComponents.DotNetBar.ButtonX();
            this.buttonX444 = new DevComponents.DotNetBar.ButtonX();
            this.labelX1 = new DevComponents.DotNetBar.LabelX();
            this.label3 = new System.Windows.Forms.Label();
            this.label2 = new System.Windows.Forms.Label();
            this.panelEx2 = new DevComponents.DotNetBar.PanelEx();
            this.btnClearPass = new DevComponents.DotNetBar.ButtonX();
            this.txtLoadedQuantity = new DevComponents.DotNetBar.Controls.TextBoxX();
            this.label8 = new System.Windows.Forms.Label();
            this.txtYield = new DevComponents.DotNetBar.Controls.TextBoxX();
            this.label7 = new System.Windows.Forms.Label();
            this.txtFail = new DevComponents.DotNetBar.Controls.TextBoxX();
            this.txtPass = new DevComponents.DotNetBar.Controls.TextBoxX();
            this.txtRemaining = new DevComponents.DotNetBar.Controls.TextBoxX();
            this.label4 = new System.Windows.Forms.Label();
            this.label5 = new System.Windows.Forms.Label();
            this.label6 = new System.Windows.Forms.Label();
            this.txtStartTime = new DevComponents.DotNetBar.Controls.TextBoxX();
            this.txtQuantity = new DevComponents.DotNetBar.Controls.TextBoxX();
            this.txtWorkOrder = new DevComponents.DotNetBar.Controls.TextBoxX();
            this.lblStartTime = new System.Windows.Forms.Label();
            this.lblWorkOrder = new System.Windows.Forms.Label();
            this.lblQuantity = new System.Windows.Forms.Label();
            this.panelEx3 = new DevComponents.DotNetBar.PanelEx();
            this.txtcycletime = new DevComponents.DotNetBar.Controls.TextBoxX();
            this.label9 = new System.Windows.Forms.Label();
            this.txtArticleComments = new DevComponents.DotNetBar.Controls.TextBoxX();
            this.txtArticleDescription = new DevComponents.DotNetBar.Controls.TextBoxX();
            this.txtArticle = new DevComponents.DotNetBar.Controls.TextBoxX();
            this.label1 = new System.Windows.Forms.Label();
            this.lblArticleDescription = new System.Windows.Forms.Label();
            this.lblArticle = new System.Windows.Forms.Label();
            this.labelIconPass = new System.Windows.Forms.Label();
            this.labelIconEmpty = new System.Windows.Forms.Label();
            this.labelIconProd = new System.Windows.Forms.Label();
            this.labelIconError = new System.Windows.Forms.Label();
            this.labelIconFail = new System.Windows.Forms.Label();
            this.buttonX5 = new DevComponents.DotNetBar.ButtonX();
            this.buttonX3 = new DevComponents.DotNetBar.ButtonX();
            this.buttonX2 = new DevComponents.DotNetBar.ButtonX();
            this.buttonX1 = new DevComponents.DotNetBar.ButtonX();
            this.lblPosition = new DevComponents.DotNetBar.Controls.ReflectionLabel();
            this.elementHost1 = new System.Windows.Forms.Integration.ElementHost();
            this.dialTable = new AMStudio.UserInterface.DialTableUserControl();
            this.panelEx1.SuspendLayout();
            this.panelEx2.SuspendLayout();
            this.panelEx3.SuspendLayout();
            this.SuspendLayout();
            // 
            // panelEx1
            // 
            this.panelEx1.CanvasColor = System.Drawing.SystemColors.Control;
            this.panelEx1.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007;
            this.panelEx1.Controls.Add(this.elementHost1);
            this.panelEx1.Controls.Add(this.lblNestID);
            this.panelEx1.Controls.Add(this.buttonX6);
            this.panelEx1.Controls.Add(this.buttonX444);
            this.panelEx1.Controls.Add(this.labelX1);
            this.panelEx1.Controls.Add(this.label3);
            this.panelEx1.Controls.Add(this.label2);
            this.panelEx1.Controls.Add(this.panelEx2);
            this.panelEx1.Controls.Add(this.panelEx3);
            this.panelEx1.Controls.Add(this.labelIconPass);
            this.panelEx1.Controls.Add(this.labelIconEmpty);
            this.panelEx1.Controls.Add(this.labelIconProd);
            this.panelEx1.Controls.Add(this.labelIconError);
            this.panelEx1.Controls.Add(this.labelIconFail);
            this.panelEx1.Controls.Add(this.buttonX5);
            this.panelEx1.Controls.Add(this.buttonX3);
            this.panelEx1.Controls.Add(this.buttonX2);
            this.panelEx1.Controls.Add(this.buttonX1);
            this.panelEx1.Controls.Add(this.lblPosition);
            this.panelEx1.Controls.Add(this.nestTableUI1);
            this.panelEx1.Dock = System.Windows.Forms.DockStyle.Fill;
            this.panelEx1.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.panelEx1.Location = new System.Drawing.Point(0, 0);
            this.panelEx1.Name = "panelEx1";
            this.panelEx1.Size = new System.Drawing.Size(1000, 725);
            this.panelEx1.Style.Alignment = System.Drawing.StringAlignment.Center;
            this.panelEx1.Style.BackColor1.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground;
            this.panelEx1.Style.BackColor2.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2;
            this.panelEx1.Style.Border = DevComponents.DotNetBar.eBorderType.SingleLine;
            this.panelEx1.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder;
            this.panelEx1.Style.ForeColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText;
            this.panelEx1.Style.GradientAngle = 90;
            this.panelEx1.TabIndex = 2;
            this.panelEx1.Click += new System.EventHandler(this.panelEx1_Click);
            // 
            // nestTableUI1
            // 
            this.nestTableUI1.AccessibleRole = System.Windows.Forms.AccessibleRole.SplitButton;
            this.nestTableUI1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
            | System.Windows.Forms.AnchorStyles.Left) 
            | System.Windows.Forms.AnchorStyles.Right)));
            this.nestTableUI1.Clockwise = true;
            this.nestTableUI1.Holes = 6;
            this.nestTableUI1.HorizontalAngle = 0D;
            this.nestTableUI1.Location = new System.Drawing.Point(119, 166);
            this.nestTableUI1.Name = "nestTableUI1";
            this.nestTableUI1.OvenStatus = 0;
            this.nestTableUI1.ShowText = true;
            this.nestTableUI1.Size = new System.Drawing.Size(817, 541);
            this.nestTableUI1.StartHole = 0;
            this.nestTableUI1.Station_Names = new string[] {
        "01 Load",
        "02 Pressfit",
        "03 Assembly",
        "04 Pressfit",
        "05 Vision",
        "06 PinCheck"};
            this.nestTableUI1.Status1 = new bool[] {
        false,
        false,
        false,
        false,
        false,
        false};
            this.nestTableUI1.Status2 = new bool[] {
        false,
        false,
        false,
        false,
        false,
        false};
            this.nestTableUI1.TabIndex = 0;
            this.nestTableUI1.Visible = false;
            // 
            // lblNestID
            // 
            this.lblNestID.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
            this.lblNestID.Location = new System.Drawing.Point(521, 698);
            this.lblNestID.Name = "lblNestID";
            this.lblNestID.Size = new System.Drawing.Size(14, 14);
            this.lblNestID.TabIndex = 100;
            this.lblNestID.Text = "1";
            // 
            // buttonX6
            // 
            this.buttonX6.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
            this.buttonX6.ImeMode = System.Windows.Forms.ImeMode.NoControl;
            this.buttonX6.Location = new System.Drawing.Point(17, 184);
            this.buttonX6.Name = "buttonX6";
            this.buttonX6.Size = new System.Drawing.Size(65, 56);
            this.buttonX6.TabIndex = 99;
            this.buttonX6.Text = "Turn";
            // 
            // buttonX444
            // 
            this.buttonX444.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
            this.buttonX444.ImeMode = System.Windows.Forms.ImeMode.NoControl;
            this.buttonX444.Location = new System.Drawing.Point(16, 255);
            this.buttonX444.Name = "buttonX444";
            this.buttonX444.Size = new System.Drawing.Size(65, 56);
            this.buttonX444.TabIndex = 101;
            this.buttonX444.Text = "Move";
            // 
            // labelX1
            // 
            this.labelX1.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
            this.labelX1.AutoSize = true;
            this.labelX1.Location = new System.Drawing.Point(448, 697);
            this.labelX1.Name = "labelX1";
            this.labelX1.Size = new System.Drawing.Size(65, 16);
            this.labelX1.TabIndex = 98;
            this.labelX1.Text = "Nest ID:";
            this.labelX1.TextAlignment = System.Drawing.StringAlignment.Far;
            // 
            // label3
            // 
            this.label3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
            this.label3.AutoSize = true;
            this.label3.BackColor = System.Drawing.Color.Transparent;
            this.label3.Font = new System.Drawing.Font("Arial", 9F);
            this.label3.Location = new System.Drawing.Point(356, 5);
            this.label3.Name = "label3";
            this.label3.Size = new System.Drawing.Size(66, 15);
            this.label3.TabIndex = 97;
            this.label3.Text = "WorkOrder";
            // 
            // label2
            // 
            this.label2.AutoSize = true;
            this.label2.BackColor = System.Drawing.Color.Transparent;
            this.label2.Font = new System.Drawing.Font("Arial", 9F);
            this.label2.Location = new System.Drawing.Point(30, 5);
            this.label2.Name = "label2";
            this.label2.Size = new System.Drawing.Size(49, 15);
            this.label2.TabIndex = 96;
            this.label2.Text = "Product";
            // 
            // panelEx2
            // 
            this.panelEx2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
            this.panelEx2.CanvasColor = System.Drawing.SystemColors.Control;
            this.panelEx2.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007;
            this.panelEx2.Controls.Add(this.btnClearPass);
            this.panelEx2.Controls.Add(this.txtLoadedQuantity);
            this.panelEx2.Controls.Add(this.label8);
            this.panelEx2.Controls.Add(this.txtYield);
            this.panelEx2.Controls.Add(this.label7);
            this.panelEx2.Controls.Add(this.txtFail);
            this.panelEx2.Controls.Add(this.txtPass);
            this.panelEx2.Controls.Add(this.txtRemaining);
            this.panelEx2.Controls.Add(this.label4);
            this.panelEx2.Controls.Add(this.label5);
            this.panelEx2.Controls.Add(this.label6);
            this.panelEx2.Controls.Add(this.txtStartTime);
            this.panelEx2.Controls.Add(this.txtQuantity);
            this.panelEx2.Controls.Add(this.txtWorkOrder);
            this.panelEx2.Controls.Add(this.lblStartTime);
            this.panelEx2.Controls.Add(this.lblWorkOrder);
            this.panelEx2.Controls.Add(this.lblQuantity);
            this.panelEx2.Location = new System.Drawing.Point(343, 11);
            this.panelEx2.Name = "panelEx2";
            this.panelEx2.Size = new System.Drawing.Size(651, 129);
            this.panelEx2.Style.Alignment = System.Drawing.StringAlignment.Center;
            this.panelEx2.Style.BackColor1.Alpha = ((byte)(0));
            this.panelEx2.Style.BackColor1.Color = System.Drawing.Color.Transparent;
            this.panelEx2.Style.BackColor2.Alpha = ((byte)(0));
            this.panelEx2.Style.BackColor2.Color = System.Drawing.Color.Transparent;
            this.panelEx2.Style.Border = DevComponents.DotNetBar.eBorderType.SingleLine;
            this.panelEx2.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder;
            this.panelEx2.Style.ForeColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText;
            this.panelEx2.Style.GradientAngle = 90;
            this.panelEx2.TabIndex = 93;
            // 
            // btnClearPass
            // 
            this.btnClearPass.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
            this.btnClearPass.ImeMode = System.Windows.Forms.ImeMode.NoControl;
            this.btnClearPass.Location = new System.Drawing.Point(587, 45);
            this.btnClearPass.Name = "btnClearPass";
            this.btnClearPass.Size = new System.Drawing.Size(41, 21);
            this.btnClearPass.TabIndex = 114;
            this.btnClearPass.Text = "Clear";
            this.btnClearPass.Click += new System.EventHandler(this.btnClearPass_Click);
            // 
            // txtLoadedQuantity
            // 
            this.txtLoadedQuantity.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(227)))), ((int)(((byte)(239)))), ((int)(((byte)(255)))));
            // 
            // 
            // 
            this.txtLoadedQuantity.Border.Class = "TextBoxBorder";
            this.txtLoadedQuantity.Location = new System.Drawing.Point(122, 102);
            this.txtLoadedQuantity.Name = "txtLoadedQuantity";
            this.txtLoadedQuantity.Size = new System.Drawing.Size(272, 21);
            this.txtLoadedQuantity.TabIndex = 113;
            // 
            // label8
            // 
            this.label8.AutoSize = true;
            this.label8.BackColor = System.Drawing.Color.Transparent;
            this.label8.Font = new System.Drawing.Font("宋体", 9F);
            this.label8.Location = new System.Drawing.Point(10, 106);
            this.label8.Name = "label8";
            this.label8.Size = new System.Drawing.Size(101, 12);
            this.label8.TabIndex = 112;
            this.label8.Text = "Loaded Quantity:";
            // 
            // txtYield
            // 
            this.txtYield.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(227)))), ((int)(((byte)(239)))), ((int)(((byte)(255)))));
            // 
            // 
            // 
            this.txtYield.Border.Class = "TextBoxBorder";
            this.txtYield.Location = new System.Drawing.Point(518, 102);
            this.txtYield.Name = "txtYield";
            this.txtYield.Size = new System.Drawing.Size(110, 21);
            this.txtYield.TabIndex = 111;
            // 
            // label7
            // 
            this.label7.AutoSize = true;
            this.label7.BackColor = System.Drawing.Color.Transparent;
            this.label7.Font = new System.Drawing.Font("宋体", 9F);
            this.label7.Location = new System.Drawing.Point(427, 104);
            this.label7.Name = "label7";
            this.label7.Size = new System.Drawing.Size(41, 12);
            this.label7.TabIndex = 110;
            this.label7.Text = "Yield:";
            // 
            // txtFail
            // 
            this.txtFail.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(227)))), ((int)(((byte)(239)))), ((int)(((byte)(255)))));
            // 
            // 
            // 
            this.txtFail.Border.Class = "TextBoxBorder";
            this.txtFail.Location = new System.Drawing.Point(518, 75);
            this.txtFail.Name = "txtFail";
            this.txtFail.Size = new System.Drawing.Size(110, 21);
            this.txtFail.TabIndex = 108;
            // 
            // txtPass
            // 
            this.txtPass.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(227)))), ((int)(((byte)(239)))), ((int)(((byte)(255)))));
            // 
            // 
            // 
            this.txtPass.Border.Class = "TextBoxBorder";
            this.txtPass.Location = new System.Drawing.Point(518, 45);
            this.txtPass.Name = "txtPass";
            this.txtPass.Size = new System.Drawing.Size(63, 21);
            this.txtPass.TabIndex = 109;
            // 
            // txtRemaining
            // 
            this.txtRemaining.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(227)))), ((int)(((byte)(239)))), ((int)(((byte)(255)))));
            // 
            // 
            // 
            this.txtRemaining.Border.Class = "TextBoxBorder";
            this.txtRemaining.Location = new System.Drawing.Point(518, 16);
            this.txtRemaining.Name = "txtRemaining";
            this.txtRemaining.Size = new System.Drawing.Size(110, 21);
            this.txtRemaining.TabIndex = 107;
            // 
            // label4
            // 
            this.label4.AutoSize = true;
            this.label4.BackColor = System.Drawing.Color.Transparent;
            this.label4.Font = new System.Drawing.Font("宋体", 9F);
            this.label4.Location = new System.Drawing.Point(427, 77);
            this.label4.Name = "label4";
            this.label4.Size = new System.Drawing.Size(35, 12);
            this.label4.TabIndex = 106;
            this.label4.Text = "Fail:";
            // 
            // label5
            // 
            this.label5.AutoSize = true;
            this.label5.BackColor = System.Drawing.Color.Transparent;
            this.label5.Font = new System.Drawing.Font("宋体", 9F);
            this.label5.Location = new System.Drawing.Point(427, 47);
            this.label5.Name = "label5";
            this.label5.Size = new System.Drawing.Size(35, 12);
            this.label5.TabIndex = 105;
            this.label5.Text = "Pass:";
            // 
            // label6
            // 
            this.label6.AutoSize = true;
            this.label6.BackColor = System.Drawing.Color.Transparent;
            this.label6.Font = new System.Drawing.Font("宋体", 9F);
            this.label6.Location = new System.Drawing.Point(427, 18);
            this.label6.Name = "label6";
            this.label6.Size = new System.Drawing.Size(65, 12);
            this.label6.TabIndex = 104;
            this.label6.Text = "Remaining:";
            // 
            // txtStartTime
            // 
            this.txtStartTime.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(227)))), ((int)(((byte)(239)))), ((int)(((byte)(255)))));
            // 
            // 
            // 
            this.txtStartTime.Border.Class = "TextBoxBorder";
            this.txtStartTime.Location = new System.Drawing.Point(122, 75);
            this.txtStartTime.Name = "txtStartTime";
            this.txtStartTime.Size = new System.Drawing.Size(272, 21);
            this.txtStartTime.TabIndex = 97;
            // 
            // txtQuantity
            // 
            this.txtQuantity.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(227)))), ((int)(((byte)(239)))), ((int)(((byte)(255)))));
            // 
            // 
            // 
            this.txtQuantity.Border.Class = "TextBoxBorder";
            this.txtQuantity.Location = new System.Drawing.Point(122, 45);
            this.txtQuantity.Name = "txtQuantity";
            this.txtQuantity.Size = new System.Drawing.Size(272, 21);
            this.txtQuantity.TabIndex = 96;
            // 
            // txtWorkOrder
            // 
            this.txtWorkOrder.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(227)))), ((int)(((byte)(239)))), ((int)(((byte)(255)))));
            // 
            // 
            // 
            this.txtWorkOrder.Border.Class = "TextBoxBorder";
            this.txtWorkOrder.Location = new System.Drawing.Point(122, 16);
            this.txtWorkOrder.Name = "txtWorkOrder";
            this.txtWorkOrder.Size = new System.Drawing.Size(272, 21);
            this.txtWorkOrder.TabIndex = 95;
            // 
            // lblStartTime
            // 
            this.lblStartTime.AutoSize = true;
            this.lblStartTime.BackColor = System.Drawing.Color.Transparent;
            this.lblStartTime.Font = new System.Drawing.Font("宋体", 9F);
            this.lblStartTime.Location = new System.Drawing.Point(10, 77);
            this.lblStartTime.Name = "lblStartTime";
            this.lblStartTime.Size = new System.Drawing.Size(71, 12);
            this.lblStartTime.TabIndex = 10;
            this.lblStartTime.Text = "Start Time:";
            // 
            // lblWorkOrder
            // 
            this.lblWorkOrder.BackColor = System.Drawing.Color.Transparent;
            this.lblWorkOrder.Font = new System.Drawing.Font("宋体", 9F);
            this.lblWorkOrder.Location = new System.Drawing.Point(10, 18);
            this.lblWorkOrder.Name = "lblWorkOrder";
            this.lblWorkOrder.Size = new System.Drawing.Size(71, 12);
            this.lblWorkOrder.TabIndex = 4;
            this.lblWorkOrder.Text = "Work Order:";
            // 
            // lblQuantity
            // 
            this.lblQuantity.AutoSize = true;
            this.lblQuantity.BackColor = System.Drawing.Color.Transparent;
            this.lblQuantity.Font = new System.Drawing.Font("宋体", 9F);
            this.lblQuantity.Location = new System.Drawing.Point(10, 47);
            this.lblQuantity.Name = "lblQuantity";
            this.lblQuantity.Size = new System.Drawing.Size(59, 12);
            this.lblQuantity.TabIndex = 6;
            this.lblQuantity.Text = "Quantity:";
            // 
            // panelEx3
            // 
            this.panelEx3.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
            | System.Windows.Forms.AnchorStyles.Right)));
            this.panelEx3.CanvasColor = System.Drawing.SystemColors.Control;
            this.panelEx3.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007;
            this.panelEx3.Controls.Add(this.txtcycletime);
            this.panelEx3.Controls.Add(this.label9);
            this.panelEx3.Controls.Add(this.txtArticleComments);
            this.panelEx3.Controls.Add(this.txtArticleDescription);
            this.panelEx3.Controls.Add(this.txtArticle);
            this.panelEx3.Controls.Add(this.label1);
            this.panelEx3.Controls.Add(this.lblArticleDescription);
            this.panelEx3.Controls.Add(this.lblArticle);
            this.panelEx3.Location = new System.Drawing.Point(15, 11);
            this.panelEx3.Name = "panelEx3";
            this.panelEx3.Size = new System.Drawing.Size(322, 129);
            this.panelEx3.Style.Alignment = System.Drawing.StringAlignment.Center;
            this.panelEx3.Style.BackColor1.Alpha = ((byte)(0));
            this.panelEx3.Style.BackColor1.Color = System.Drawing.Color.Transparent;
            this.panelEx3.Style.BackColor2.Alpha = ((byte)(0));
            this.panelEx3.Style.BackColor2.Color = System.Drawing.Color.Transparent;
            this.panelEx3.Style.Border = DevComponents.DotNetBar.eBorderType.SingleLine;
            this.panelEx3.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder;
            this.panelEx3.Style.ForeColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText;
            this.panelEx3.Style.GradientAngle = 90;
            this.panelEx3.TabIndex = 92;
            // 
            // txtcycletime
            // 
            this.txtcycletime.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
            | System.Windows.Forms.AnchorStyles.Right)));
            this.txtcycletime.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(227)))), ((int)(((byte)(239)))), ((int)(((byte)(255)))));
            // 
            // 
            // 
            this.txtcycletime.Border.Class = "TextBoxBorder";
            this.txtcycletime.Location = new System.Drawing.Point(104, 102);
            this.txtcycletime.Name = "txtcycletime";
            this.txtcycletime.Size = new System.Drawing.Size(199, 21);
            this.txtcycletime.TabIndex = 115;
            // 
            // label9
            // 
            this.label9.AutoSize = true;
            this.label9.BackColor = System.Drawing.Color.Transparent;
            this.label9.Font = new System.Drawing.Font("宋体", 9F);
            this.label9.Location = new System.Drawing.Point(13, 109);
            this.label9.Name = "label9";
            this.label9.Size = new System.Drawing.Size(71, 12);
            this.label9.TabIndex = 114;
            this.label9.Text = "Cycle Time:";
            // 
            // txtArticleComments
            // 
            this.txtArticleComments.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
            | System.Windows.Forms.AnchorStyles.Right)));
            this.txtArticleComments.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(227)))), ((int)(((byte)(239)))), ((int)(((byte)(255)))));
            // 
            // 
            // 
            this.txtArticleComments.Border.Class = "TextBoxBorder";
            this.txtArticleComments.Location = new System.Drawing.Point(104, 75);
            this.txtArticleComments.Name = "txtArticleComments";
            this.txtArticleComments.Size = new System.Drawing.Size(199, 21);
            this.txtArticleComments.TabIndex = 95;
            // 
            // txtArticleDescription
            // 
            this.txtArticleDescription.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
            | System.Windows.Forms.AnchorStyles.Right)));
            this.txtArticleDescription.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(227)))), ((int)(((byte)(239)))), ((int)(((byte)(255)))));
            // 
            // 
            // 
            this.txtArticleDescription.Border.Class = "TextBoxBorder";
            this.txtArticleDescription.Location = new System.Drawing.Point(104, 45);
            this.txtArticleDescription.Name = "txtArticleDescription";
            this.txtArticleDescription.Size = new System.Drawing.Size(199, 21);
            this.txtArticleDescription.TabIndex = 95;
            // 
            // txtArticle
            // 
            this.txtArticle.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
            | System.Windows.Forms.AnchorStyles.Right)));
            this.txtArticle.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(227)))), ((int)(((byte)(239)))), ((int)(((byte)(255)))));
            // 
            // 
            // 
            this.txtArticle.Border.Class = "TextBoxBorder";
            this.txtArticle.Location = new System.Drawing.Point(104, 16);
            this.txtArticle.Name = "txtArticle";
            this.txtArticle.Size = new System.Drawing.Size(199, 21);
            this.txtArticle.TabIndex = 94;
            // 
            // label1
            // 
            this.label1.AutoSize = true;
            this.label1.BackColor = System.Drawing.Color.Transparent;
            this.label1.Font = new System.Drawing.Font("宋体", 9F);
            this.label1.Location = new System.Drawing.Point(13, 77);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(53, 12);
            this.label1.TabIndex = 16;
            this.label1.Text = "Comment:";
            // 
            // lblArticleDescription
            // 
            this.lblArticleDescription.AutoSize = true;
            this.lblArticleDescription.BackColor = System.Drawing.Color.Transparent;
            this.lblArticleDescription.Font = new System.Drawing.Font("宋体", 9F);
            this.lblArticleDescription.Location = new System.Drawing.Point(13, 47);
            this.lblArticleDescription.Name = "lblArticleDescription";
            this.lblArticleDescription.Size = new System.Drawing.Size(77, 12);
            this.lblArticleDescription.TabIndex = 14;
            this.lblArticleDescription.Text = "Description:";
            // 
            // lblArticle
            // 
            this.lblArticle.AutoSize = true;
            this.lblArticle.BackColor = System.Drawing.Color.Transparent;
            this.lblArticle.Font = new System.Drawing.Font("宋体", 9F);
            this.lblArticle.Location = new System.Drawing.Point(13, 18);
            this.lblArticle.Name = "lblArticle";
            this.lblArticle.Size = new System.Drawing.Size(35, 12);
            this.lblArticle.TabIndex = 12;
            this.lblArticle.Text = "Name:";
            // 
            // labelIconPass
            // 
            this.labelIconPass.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
            this.labelIconPass.BackColor = System.Drawing.Color.Transparent;
            this.labelIconPass.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.labelIconPass.Image = ((System.Drawing.Image)(resources.GetObject("labelIconPass.Image")));
            this.labelIconPass.Location = new System.Drawing.Point(927, 590);
            this.labelIconPass.Name = "labelIconPass";
            this.labelIconPass.Size = new System.Drawing.Size(67, 17);
            this.labelIconPass.TabIndex = 63;
            this.labelIconPass.Text = "PASS";
            this.labelIconPass.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
            // 
            // labelIconEmpty
            // 
            this.labelIconEmpty.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
            this.labelIconEmpty.BackColor = System.Drawing.Color.Transparent;
            this.labelIconEmpty.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.labelIconEmpty.Image = ((System.Drawing.Image)(resources.GetObject("labelIconEmpty.Image")));
            this.labelIconEmpty.Location = new System.Drawing.Point(927, 640);
            this.labelIconEmpty.Name = "labelIconEmpty";
            this.labelIconEmpty.Size = new System.Drawing.Size(67, 17);
            this.labelIconEmpty.TabIndex = 65;
            this.labelIconEmpty.Text = "EMPTY";
            this.labelIconEmpty.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
            // 
            // labelIconProd
            // 
            this.labelIconProd.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
            this.labelIconProd.BackColor = System.Drawing.Color.Transparent;
            this.labelIconProd.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.labelIconProd.Image = ((System.Drawing.Image)(resources.GetObject("labelIconProd.Image")));
            this.labelIconProd.Location = new System.Drawing.Point(927, 665);
            this.labelIconProd.Name = "labelIconProd";
            this.labelIconProd.Size = new System.Drawing.Size(67, 17);
            this.labelIconProd.TabIndex = 66;
            this.labelIconProd.Text = "BUSY";
            this.labelIconProd.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
            // 
            // labelIconError
            // 
            this.labelIconError.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
            this.labelIconError.BackColor = System.Drawing.Color.Transparent;
            this.labelIconError.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.labelIconError.Image = ((System.Drawing.Image)(resources.GetObject("labelIconError.Image")));
            this.labelIconError.Location = new System.Drawing.Point(927, 690);
            this.labelIconError.Name = "labelIconError";
            this.labelIconError.Size = new System.Drawing.Size(67, 17);
            this.labelIconError.TabIndex = 67;
            this.labelIconError.Text = "ERROR";
            this.labelIconError.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
            // 
            // labelIconFail
            // 
            this.labelIconFail.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
            this.labelIconFail.BackColor = System.Drawing.Color.Transparent;
            this.labelIconFail.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.labelIconFail.Image = ((System.Drawing.Image)(resources.GetObject("labelIconFail.Image")));
            this.labelIconFail.Location = new System.Drawing.Point(927, 615);
            this.labelIconFail.Name = "labelIconFail";
            this.labelIconFail.Size = new System.Drawing.Size(67, 17);
            this.labelIconFail.TabIndex = 64;
            this.labelIconFail.Text = "FAIL";
            this.labelIconFail.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
            // 
            // buttonX5
            // 
            this.buttonX5.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
            this.buttonX5.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
            this.buttonX5.Location = new System.Drawing.Point(16, 655);
            this.buttonX5.Name = "buttonX5";
            this.buttonX5.Size = new System.Drawing.Size(65, 56);
            this.buttonX5.TabIndex = 61;
            this.buttonX5.Text = "Reset";
            // 
            // buttonX3
            // 
            this.buttonX3.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
            this.buttonX3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
            this.buttonX3.Location = new System.Drawing.Point(16, 593);
            this.buttonX3.Name = "buttonX3";
            this.buttonX3.Size = new System.Drawing.Size(65, 56);
            this.buttonX3.TabIndex = 60;
            this.buttonX3.Text = "Retry";
            // 
            // buttonX2
            // 
            this.buttonX2.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
            this.buttonX2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
            this.buttonX2.Location = new System.Drawing.Point(16, 531);
            this.buttonX2.Name = "buttonX2";
            this.buttonX2.Size = new System.Drawing.Size(65, 56);
            this.buttonX2.TabIndex = 59;
            this.buttonX2.Text = "Reject";
            // 
            // buttonX1
            // 
            this.buttonX1.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
            this.buttonX1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
            this.buttonX1.ImeMode = System.Windows.Forms.ImeMode.NoControl;
            this.buttonX1.Location = new System.Drawing.Point(16, 469);
            this.buttonX1.Name = "buttonX1";
            this.buttonX1.Size = new System.Drawing.Size(65, 56);
            this.buttonX1.TabIndex = 58;
            this.buttonX1.Text = "Next";
            // 
            // lblPosition
            // 
            this.lblPosition.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
            this.lblPosition.Location = new System.Drawing.Point(129, 640);
            this.lblPosition.Name = "lblPosition";
            this.lblPosition.Size = new System.Drawing.Size(106, 69);
            this.lblPosition.TabIndex = 57;
            this.lblPosition.Text = "<b><font size=\"+10\"><i>Autoliv</i><font color=\"#B02B2C\">Domino Assembly Line</fon" +
    "t></font></b>";
            this.lblPosition.Visible = false;
            // 
            // elementHost1
            // 
            this.elementHost1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
            | System.Windows.Forms.AnchorStyles.Left) 
            | System.Windows.Forms.AnchorStyles.Right)));
            this.elementHost1.Location = new System.Drawing.Point(147, 171);
            this.elementHost1.Name = "elementHost1";
            this.elementHost1.Size = new System.Drawing.Size(708, 511);
            this.elementHost1.TabIndex = 102;
            this.elementHost1.Text = "elementHost1";
            this.elementHost1.Child = this.dialTable;
            // 
            // MainUI
            // 
            this.Controls.Add(this.panelEx1);
            this.Name = "MainUI";
            this.Size = new System.Drawing.Size(1000, 725);
            this.Load += new System.EventHandler(this.MainUI_Load);
            this.panelEx1.ResumeLayout(false);
            this.panelEx1.PerformLayout();
            this.panelEx2.ResumeLayout(false);
            this.panelEx2.PerformLayout();
            this.panelEx3.ResumeLayout(false);
            this.panelEx3.PerformLayout();
            this.ResumeLayout(false);

        }

        private void panelEx1_Click(object sender, EventArgs e)
        {

        }

        private void MainUI_Load(object sender, EventArgs e)
        {

            this.nestTableUI1.HoleClickEventHandler = new EventHandler<Windows.Forms.HoleEventArgs>(HoleSelect);
            base.SubscribeEvent("MANAGER_RET");

           


        }
        private void HoleSelect(object sender, Windows.Forms.HoleEventArgs e)
        {
            //EventBroker.RegisterPublisher("ACTIVE_STATION1UI", this, "ACTIVE_STATION1UI");
            string stationName = "StationUI" + e.SelectedItem.ToString("00");
            Shell.ActiveModule(stationName);
        }

        RadialGradientBrush brushRing = new RadialGradientBrush(System.Windows.Media.Color.FromRgb(170, 234, 250), System.Windows.Media.Color.FromRgb(170, 234, 250));

        RadialGradientBrush brushGray = new RadialGradientBrush(System.Windows.Media.Color.FromRgb(111, 111, 111), System.Windows.Media.Color.FromRgb(155, 155, 155));
        RadialGradientBrush brushLightGray = new RadialGradientBrush(System.Windows.Media.Color.FromRgb(222, 222, 222), System.Windows.Media.Color.FromRgb(222, 222, 222));
        RadialGradientBrush brushRed = new RadialGradientBrush(System.Windows.Media.Color.FromRgb(255, 0, 50), System.Windows.Media.Color.FromRgb(255, 0, 50));
        RadialGradientBrush brushLightRed = new RadialGradientBrush(System.Windows.Media.Color.FromRgb(255, 0, 50), System.Windows.Media.Color.FromRgb(255, 0, 50));

        RadialGradientBrush brushGreen = new RadialGradientBrush(System.Windows.Media.Color.FromRgb(0, 170, 0), System.Windows.Media.Color.FromRgb(0, 170, 0));
        RadialGradientBrush brushAqua = new RadialGradientBrush(System.Windows.Media.Color.FromRgb(100, 255, 255), System.Windows.Media.Color.FromRgb(100, 255, 255));
        RadialGradientBrush brushOrange = new RadialGradientBrush(System.Windows.Media.Color.FromRgb(255, 255, 0), System.Windows.Media.Color.FromRgb(255, 255, 0));
        private List<System.Windows.Controls.Button> stnList = new List<System.Windows.Controls.Button>();
        private List<System.Windows.Controls.Label> enList = new List<System.Windows.Controls.Label>();
        private List<System.Windows.Controls.Label> homeList = new List<System.Windows.Controls.Label>();
        protected override void UIDB_RfreshTag(Common.UserInterfaceItem item)
        {
            int total= Environment.TickCount;
            if (item.RelatedControl is DevComponents.DotNetBar.ButtonX)
            {
                DevComponents.DotNetBar.ButtonX button = item.RelatedControl as DevComponents.DotNetBar.ButtonX;
                if ((bool)item.value)
                {
                    //button.Enabled = true;
                    button.Style = DevComponents.DotNetBar.eDotNetBarStyle.Office2003;
                    button.Checked = true;
                }
                else
                {
                    //button.Enabled = false;
                    button.Style = DevComponents.DotNetBar.eDotNetBarStyle.Office2007;
                    button.Checked = false;
                }
            }
            else if (item.RelatedControl is AMStudio.Windows.Forms.NestTableUI)
            {
                if (stnList.Count == 0)
                {
                    stnList.Add(dialTable.stn1);
                    stnList.Add(dialTable.stn2);
                    stnList.Add(dialTable.stn3);
                    stnList.Add(dialTable.stn4);
                    stnList.Add(dialTable.stn5);
                    stnList.Add(dialTable.stn6);
                    
                }
                if (enList.Count == 0)
                {
                    enList.Add(dialTable.en1);
                    enList.Add(dialTable.en2);
                    enList.Add(dialTable.en3);
                    enList.Add(dialTable.en4);
                    enList.Add(dialTable.en5);
                    enList.Add(dialTable.en6);
                   
                }
                if (homeList.Count == 0)
                {
                    homeList.Add(dialTable.home1);
                    homeList.Add(dialTable.home2);
                    homeList.Add(dialTable.home3);
                    homeList.Add(dialTable.home4);
                    homeList.Add(dialTable.home5);
                    homeList.Add(dialTable.home6);

                }

                
                int a = Environment.TickCount;
                string[] res = item.value.ToString().Split(';');
                if (res.Length >= 10)
                {
                    //for (int i = 0; i < 6; i++)
                    //{
                    //    int productState = int.Parse(res[i + 2]);
                    //    if (productState == 0)
                    //    {
                    //        this.nestTableUI1.Status[i] = System.Drawing.Color.Gray;
                    //    }
                    //    else if (productState == 1)
                    //    {
                    //        this.nestTableUI1.Status[i] = System.Drawing.Color.Green;
                    //    }
                    //    else if (productState == 2)
                    //    {
                    //        this.nestTableUI1.Status[i] = System.Drawing.Color.Red;
                    //    }
                    //}
                    //int temp = 0;
                    //int stationBusy = int.Parse(res[1]);
                    //for (int i = 1; i <= 6; i++)
                    //{
                    //    temp = 1 << i;
                    //    if ((stationBusy & temp) > 0)
                    //    {
                    //        this.nestTableUI1.Status[i-1] = System.Drawing.Color.Aqua;
                    //    }
                    //}
                    //int stationError = int.Parse(res[0]);
                    //for (int i = 1; i <= 6; i++)
                    //{
                    //    temp = 1 << i;
                    //    if ((stationError & temp) > 0)
                    //    {
                    //        this.nestTableUI1.Status[i-1] = System.Drawing.Color.Orange;
                    //    }
                    //}
                    //int productState1 = int.Parse(res[2]);
                    //if (productState1==0)
                    //{
                    //    this.nestTableUI1.Status[0] = System.Drawing.Color.Gray;
                    //}
                    for (int i = 0; i < nestTableUI1.Holes; i++)
                    {
                        int productState = int.Parse(res[i+2]);
                        if (productState == 0)
                        {
                            this.nestTableUI1.Status[i] = System.Drawing.Color.Gray;
                            stnList[i].Background = brushGray;
                        }
                        else if (productState == 1)
                        {
                            this.nestTableUI1.Status[i] = System.Drawing.Color.Green;
                            stnList[i].Background = brushGreen;
                        }
                        else if (productState == 2)
                        {
                            this.nestTableUI1.Status[i] = System.Drawing.Color.Red;
                            stnList[i].Background = brushRed;
                        }
                    }
                    int temp = 0;
                    int stationBusy = int.Parse(res[1]);
                    for (int i = 0; i <= nestTableUI1.Holes; i++)
                    {
                        temp = 1 << i;
                        if ((stationBusy & temp) > 0)
                        {
                            //this.nestTableUI1.Status[i] = System.Drawing.Color.Aqua;
                            stnList[i].Background = brushAqua;
                        }
                    }
                    int stationError = int.Parse(res[0]);
                    for (int i = 0; i <= nestTableUI1.Holes; i++)
                    {
                        temp = 1 << i;
                        if ((stationError & temp) > 0)
                        {
                            //this.nestTableUI1.Status[i] = System.Drawing.Color.Orange;
                            stnList[i].Background = brushOrange;
                        }
                    }
                    int productState1 = int.Parse(res[2]);
                    if (productState1 == 0)
                    {
                        this.nestTableUI1.Status[0] = System.Drawing.Color.Gray;
                        stnList[0].Background = brushGray;
                    }


                    int stationdisabled = int.Parse(res[8]);
                    for (int i = 0; i < 6; i++)
                    {
                        temp = 1 << i;
                        //if ((stationdisabled & temp) > 0)
                        //{
                        //    this.nestTableUI1.Status2[i ] = false;
                        //}
                        //else
                        //{
                        //    this.nestTableUI1.Status2[i ] = true;

                        //}
                        if ((stationdisabled & temp) > 0)
                        {

                            enList[i].Content = "禁用";
                            enList[i].Background = brushOrange;
                        }
                        else
                        {

                            enList[i].Content = "启用";
                            enList[i].Background = dialTable.arcRing.Fill;
                        }
                    }

                    int stationoriginaled = int.Parse(res[9]);
                    for (int i = 0; i <= 6; i++)
                    {
                        temp = 1 << i;
                        //if ((stationoriginaled & temp) > 0)
                        //{
                        //    this.nestTableUI1.Status1[i - 1] = true;
                        //}
                        //else
                        //{
                        //    this.nestTableUI1.Status1[i - 1] = false;

                        //}
                        if ((stationoriginaled & temp) > 0)
                        {

                            homeList[i].Content = "原位";
                            homeList[i].Background = dialTable.arcRing.Fill;
                        }
                        else
                        {

                            homeList[i].Content = "复位";
                            homeList[i].Background = brushLightRed;
                        }
                
                        //开始旋转
                        
                    }
                    //bool bRun = bool.Parse(res[13]);
                    //if (bRun)
                    //{
                    //    dialTable.Run();
                    //}
                }
                //int a = Environment.TickCount;
                this.nestTableUI1.Invalidate();
                a = Environment.TickCount - a;
            }
            else if (item.RelatedControl is Label)
            {
                this.nestid = (int)item.value;

                this.lblNestID.Text = nestid.ToString();
                //this.labelX1.Text = "Nest ID:" + nestid.ToString();

            }
            try
            {
                if (item.RelatedControl.Name.ToString().ToUpper() == "TXTLOADEDQUANTITY")
                {
                    string tmp = item.value.ToString();
                    if (!string.IsNullOrEmpty(tmp))
                    {
                        int va = int.Parse(tmp);
                        this.txtLoadedQuantity.Text = va.ToString();

                        if (WorkorderDB.ActiveOrder != null)
                        {

                            WorkorderDB.ActiveOrder.Comments = va.ToString();
                            WorkorderDB.Update(WorkorderDB.ActiveOrder);
                        }
                    }

                }
                else if (item.RelatedControl.Name.ToString().ToUpper() == "TXTPASS")
                {
                    string tmp = item.value.ToString();
                    if ((!string.IsNullOrEmpty(tmp)) && (tmp != this.txtPass.Text))
                    {
                        int va = int.Parse(tmp);

                        if (WorkorderDB.ActiveOrder != null)
                        {

                            WorkorderDB.ActiveOrder.Pass = va;
                            WorkorderDB.ActiveOrder.Finished = WorkorderDB.ActiveOrder.Pass + WorkorderDB.ActiveOrder.Fail;
                            WorkorderDB.ActiveOrder.Remaining = WorkorderDB.ActiveOrder.Quantity - WorkorderDB.ActiveOrder.Pass - WorkorderDB.ActiveOrder.Fail;
                            WorkorderDB.Update(WorkorderDB.ActiveOrder);
                            this.txtRemaining.Text = WorkorderDB.ActiveOrder.Remaining.ToString();
                            if (WorkorderDB.ActiveOrder.Pass + WorkorderDB.ActiveOrder.Fail > 0)
                            {
                                float y = (float)WorkorderDB.ActiveOrder.Pass / (WorkorderDB.ActiveOrder.Pass + WorkorderDB.ActiveOrder.Fail);
                                Yield = y;
                            }
                        }
                        this.txtPass.Text = va.ToString();

                    }
                }
                else if (item.RelatedControl.Name.ToString().ToUpper() == "TXTFAIL")
                {
                    string tmp = item.value.ToString();
                    if ((!string.IsNullOrEmpty(tmp)) && (tmp != this.txtFail.Text))
                    {
                        int va = int.Parse(tmp);

                        if (WorkorderDB.ActiveOrder != null)
                        {

                            WorkorderDB.ActiveOrder.Fail = va;
                            WorkorderDB.ActiveOrder.Remaining = WorkorderDB.ActiveOrder.Quantity - WorkorderDB.ActiveOrder.Pass - WorkorderDB.ActiveOrder.Fail;
                            WorkorderDB.ActiveOrder.Finished = WorkorderDB.ActiveOrder.Pass + WorkorderDB.ActiveOrder.Fail;
                            WorkorderDB.Update(WorkorderDB.ActiveOrder);
                            this.txtRemaining.Text = WorkorderDB.ActiveOrder.Remaining.ToString();
                            if (WorkorderDB.ActiveOrder.Pass + WorkorderDB.ActiveOrder.Fail > 0)
                            {
                                float y = (float)WorkorderDB.ActiveOrder.Pass / (WorkorderDB.ActiveOrder.Pass + WorkorderDB.ActiveOrder.Fail);
                                //this.txtYield.Text = y.ToString("0.00");
                                Yield = y;
                            }
                        }

                        this.txtFail.Text = va.ToString();

                    }
                }
                else if (item.RelatedControl.Name.ToString().ToUpper() == "TXTCYCLETIME")
                {
                    string tmp = item.value.ToString();
                    if (!string.IsNullOrEmpty(tmp))
                    {
                        float ct = float.Parse(tmp) / 10;
                        this.txtcycletime.Text = ct.ToString("0.0");
                    }
                }
            }
            catch (Exception ex)
            {
            }
            total = Environment.TickCount - total;
        }

        private float Yield
        {
           
            set
            {
                NumberFormatInfo nfi = new CultureInfo("en-US", false).NumberFormat;
                nfi.PercentDecimalDigits = 0;
                this.txtYield.Text = value.ToString("P", nfi);
            }

        }

        public override bool ActivateUI()
        {
            if (!this.initialized)
            {
                this.SetUserPrivilige(null, null);
                EventBroker.RegisterSubscriber("SET_USER_PRIVILIGE", new EventHandler(SetUserPrivilige));
            }
            bool result = base.ActivateUI();
            return result;
        }
        protected virtual void SetUserPrivilige(object sender, EventArgs e)
        {
            Language_InitializeControl(this);          
        }
        private int nestid = 0;
        protected override void UIDB_ConnectTagAction(Common.UserInterfaceItem item)
        {
            item.RelatedControl.Click += (sender, e) =>
                {
                    DevComponents.DotNetBar.ButtonX button = item.RelatedControl as DevComponents.DotNetBar.ButtonX;
                    //if (button.Checked)
                    //{
                        SendMessage("UIITEM_ACTION", item);
                    //}
                };
        }
        protected override void BackGroud_EventHandler(object sender, DelegateDispather.StationEventArgs e)
        {
            base.BackGroud_EventHandler(sender, e);
            if (e.From == "MANAGER")
            {
                switch (e.Command)
                {
                    case "ACTIVE_ORDER":
                        if (WorkorderDB.ActiveProduct != null)
                        {
                            this.txtArticle.Text = WorkorderDB.ActiveProduct.Name;
                            this.txtArticleDescription.Text = WorkorderDB.ActiveProduct.Description;
                            this.txtArticleComments.Text = WorkorderDB.ActiveProduct.Comments;
                        }
                        if (WorkorderDB.ActiveOrder != null)
                        {
                            this.txtWorkOrder.Text = WorkorderDB.ActiveOrder.Name;
                            this.txtStartTime.Text = WorkorderDB.ActiveOrder.StartTime;
                            this.txtQuantity.Text = WorkorderDB.ActiveOrder.Quantity.ToString();
                            this.txtLoadedQuantity.Text = WorkorderDB.ActiveOrder.Comments;
                            this.txtRemaining.Text = WorkorderDB.ActiveOrder.Remaining.ToString();
                            this.txtPass.Text = WorkorderDB.ActiveOrder.Pass.ToString();
                            this.txtFail.Text = WorkorderDB.ActiveOrder.Fail.ToString();
                            if (WorkorderDB.ActiveOrder.Pass + WorkorderDB.ActiveOrder.Fail > 0)
                            {
                                float y = (float)WorkorderDB.ActiveOrder.Pass / (WorkorderDB.ActiveOrder.Pass + WorkorderDB.ActiveOrder.Fail);
                                Yield = y;
                            }
                        }
                        break;

                }
            }
        }

        private void buttonOvenView_Click(object sender, EventArgs e)
        {

        }

        protected override void Language_RfreshTag(LanguageItem item)
        {
            base.Language_RfreshTag(item);

            if (item.RelatedControl is AMStudio.Windows.Forms.NestTableUI)
            {

                if ((item != null) && (item.Language[LanguageString] != null))
                {
                    string[] titles = item.Language[LanguageString].ToString().Split(new string[] { "||" }, StringSplitOptions.None);

                    if (titles.Length >= 6)
                    {
                        this.nestTableUI1.Station_Names = titles;
                    }
                }
            }
        }
        protected override void Language_InitializeControl(Control UIControl)
        {
            base.Language_InitializeControl(UIControl);

            if (UIControl is AMStudio.Windows.Forms.NestTableUI)
            {
                LanguageItem item = LanguageDB.UIDBTags[this.UIName + "."] as LanguageItem;
                if ((item != null) && (item.Language[LanguageString] != null))
                {
                    string[] titles = item.Language[LanguageString].ToString().Split(new string[] { "||" }, StringSplitOptions.None);

                    if (titles.Length >= 6)
                    {
                        this.nestTableUI1.Station_Names = titles;
                    }
                }
            }


            if (UIControl is System.Windows.Forms.Integration.ElementHost)
            {
                
                LanguageItem item = LanguageDB.UIDBTags[this.UIName + "."] as LanguageItem;
                if ((item != null) && (item.Language[LanguageString] != null))
                {
                    string[] titles = item.Language[LanguageString].ToString().Split(new string[] { "||" }, StringSplitOptions.None);

                    if (titles.Length >= 6)
                    {
                        for (int i = 0; i < titles.Length; i++)
                        {
                            System.Windows.Controls.Label lb = dialTable.FindName("title" + (i + 1).ToString()) as System.Windows.Controls.Label;

                            if (lb != null)
                            {
                                lb.Content = titles[i];
                            }
                        }
                    }

                }
            }

 
            dialTable.title1.Content = "01 上料/下料";
            dialTable.title2.Content = "02 压接";
            dialTable.title3.Content = "03 组装";
            dialTable.title4.Content = "04 压接";
            dialTable.title5.Content = "05 图像检测";
            dialTable.title6.Content = "06 电测";
        }

        private void btnClearPass_Click(object sender, EventArgs e)
        {
            if (WorkorderDB.ActiveOrder != null)
            {
                WorkorderDB.ActiveOrder.Pass = 0;
                WorkorderDB.ActiveOrder.Fail = 0;
                WorkorderDB.ActiveOrder.Comments = "0";
                WorkorderDB.Update(WorkorderDB.ActiveOrder);
                this.txtPass.Text = "0";
                this.txtFail.Text = "0";
                this.txtYield.Text = "0";
                SendMessage("REACTIVE_PRODUCT",null);
                //MessageBox.Show("清零成功，请重新激活工单！", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
    }
}
